#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int main()
{
	int m = 0, n = 0, i = 0, j = 0, arr[100][100] = { 0 };
	scanf("%d %d", &m, &n);
	arr[4][4] = m;
	for (i = 0; i < n; i++)
	{
		arr[4][4] = ;
		arr[3][3] = ((m * 10) - (m * 2)) / 8;
		arr[3][4] = ((m * 10) - (m * 2)) / 8;
		arr[3][5] = ((m * 10) - (m * 2)) / 8;
		arr[4][3] = ((m * 10) - (m * 2)) / 8;
		arr[4][5] = ((m * 10) - (m * 2)) / 8;
		arr[5][3] = ((m * 10) - (m * 2)) / 8;
		arr[5][4] = ((m * 10) - (m * 2)) / 8;
		arr[5][5] = ((m * 10) - (m * 2)) / 8;
	}
	for (i = 0; i < 9; i++)
	{
		for (j = 0; j < 9; j++)
			printf("%d ", arr[i][j]);
		printf("\n");
	}
	return 0;
}